package vehialpes.canonico.transformadores;

import java.util.ArrayList;
import java.util.Collection;

import org.mule.api.transformer.TransformerException;
import org.mule.transformer.AbstractTransformer;

import vehialpes.canonico.clases.VehiculoCanonico;
import vehialpes.importaciones.Vehiculo;

public class VehiculoToCanonico extends AbstractTransformer{


	@Override
	protected Object doTransform(Object arg0, String arg1)
			throws TransformerException {
		Collection<Vehiculo> vs = (Collection<Vehiculo>)arg0;
		Collection<VehiculoCanonico> vcs = new ArrayList();
		for (Vehiculo v : vs) {
			VehiculoCanonico vc = new VehiculoCanonico();
			vc.setColor(v.getColor());
			vc.setMarca(v.getMarca());
			vc.setModelo(v.getModelo());
			vc.setPuertas(v.getPuertas());
			vc.setSerialMotor(v.getSerialMotor());
			vc.setTipo(v.getTipo());	
			vcs.add(vc);
		}
						
		return vcs;
	}
}
